function deepCopy(p,c){
    c = c || {};
    for (var i in p){
        if (p.hasOwnProperty(i)){
            if (typeof p[i] === 'object'){
                c[i] = Array.isArray(p[i])?[]:{};
                deepCopy(p[i],c[i]);
            }else{
                c[i]=p[i];
            }
        }
    }
    return c;
}
function extendCopy(p){
    var c = {};
    for (var i in p){
        c[i] = p[i];
    }
    c.uber = p;
    return c;
}
var parent = {
    numbers : [1,2,3],
    letters: ['a','b','c'],
    obj:{
        prop:1
    },
    bool : true
};

var mydeep = deepCopy(parent);
var myshallow = extendCopy(parent);
mydeep.numbers.push(4,5,6);
console.log("mydeep.numbers");
console.log(mydeep.numbers);
console.log("parent.numbers");
console.log(parent.numbers);
myshallow.numbers.push(10);
console.log("myshallow.numbers");
console.log(myshallow.numbers);
console.log("parent.numbers");
console.log(parent.numbers);
console.log("mydeep.numbers");
console.log(mydeep.numbers);
/*
function extend2(Child ,Parent){
	var p = Parent.prototype;
	var c = Child.prototype;
	for (var i in p){
		c[i] = p[i];
	}
	c.uber = p;
}
function extend (Child ,Parent){
    var F = function (){};
    F.prototype =Parent.prototype;
    Child.prototype= new F();
    Child.prototype.constructor=Child;
    Child.uber =Parent.prototype;
}
function Shape() {
}
Shape.prototype.name =	this.name = 'Shape';
Shape.prototype.toString = function () {
    var result = [];
    if (this.constructor.uber){
        result[result.length]=this.constructor.uber.toString();
    }
    result[result.length]= this.name;
    return result.join(',');
};

function TwoDShape(){}
extend(TwoDShape,Shape)
var td = new TwoDShape();
console.log("td.name");
console.log(td.name);
console.log("TwoDShape.prototype.name");
console.log(TwoDShape.prototype.name);
console.log("td.__proto__.name");
console.log(td.__proto__.name);
console.log("td.hasOwnProperty('name')");
console.log(td.hasOwnProperty('name'));
console.log("td.__proto__.hasOwnProperty('name')");
console.log(td.__proto__.hasOwnProperty('name'));

function TwoDShape(){}
extend2(TwoDShape,Shape)
TwoDShape.prototype.name ="2d shape"1200
var td2 = new TwoDShape();
console.log("td2.__proto__.hasOwnProperty('name')");
console.log(td2.__proto__.hasOwnProperty('name'));
console.log("td2.__proto__.hasOwnProperty('toString')");
console.log(td2.__proto__.hasOwnProperty('toString'));
console.log("td2.__proto__.toString === Shape.prototype.toString");
console.log(td2.__proto__.toString === Shape.prototype.toString);
*/